import 'package:flutter/material.dart';

import 'package:get/get.dart';

import '../controllers/home_controller.dart';

class HomeView extends GetView<HomeController> {
  const HomeView({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: _appBar,
      drawer: _drawer,
      body: _body,
    );
  }

  get _appBar => AppBar(
        toolbarHeight: 40,
        title: const Text('病床：xxx'),
        centerTitle: true,
      );

  get _body => DefaultTabController(
        length: 4,
        child: Container(
          decoration: const BoxDecoration(color: Colors.white),
          child: const Column(
            children: [
              // SizedBox(height: 50),
              // Text('hello'),
              TabBar(
                // indicatorWeight: 10,
                indicatorSize: TabBarIndicatorSize.tab,
                tabs: [
                  Tab(
                    // height: 10,
                    // child: Container(),
                    // child: Text('Real'),
                    child: Icon(Icons.waves),
                  ),
                  Tab(
                    // height: 10,
                    // child: Container(),
                    // child: Text('Trend'),
                    child: Icon(Icons.trending_up),
                  ),
                  Tab(
                    // height: 10,
                    // child: Container(),
                    // child: Text('Alarms'),
                    child: Icon(Icons.warning),
                  ),
                  Tab(
                    // height: 10,
                    // child: Container(),
                    // child: Text('History'),
                    child: Icon(Icons.people),
                  ),
                ],
              ),
              Expanded(
                child: TabBarView(
                  children: [
                    Icon(Icons.directions_car),
                    Icon(Icons.directions_car),
                    Icon(Icons.directions_car),
                    Icon(Icons.directions_car),
                  ],
                ),
              )
            ],
          ),
        ),
      );
  get _drawer => Drawer(
        child: ListView(
          // Important: Remove any padding from the ListView.
          padding: EdgeInsets.zero,
          children: [
            DrawerHeader(
              decoration: const BoxDecoration(
                color: Colors.blue,
              ),
              child: Text('settings'.tr),
            ),
            ListTile(
              title: Text("demo_mode".tr),
              onTap: () {},
            ),
            ListTile(
              title: Row(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Text('select_language'.tr),
                ],
              ),
              onTap: () {},
            ),
          ],
        ),
      );
}
